import Vue from "vue";
import Router from "vue-router";

// import Home from "views/home/Home.vue";
// import Categories from "views/categories/Categories.vue";
// import Shop from "views/shop/Shop.vue";
// import Profile from "views/profile/Profile.vue";
// 路由懒加载
const Home = () => import("../views/home/Home.vue");
const Categories = () => import("../views/categories/Categories.vue");
const Shop = () => import("../views/shop/Shop.vue");
const Profile = () => import("../views/profile/Profile.vue");
const Detail = () => import("../views/detail/Detail.vue");
const CategoryGoods =()=>import("../views/categories/childComps/CategoryGoods.vue")
Vue.use(Router);

export default new Router({
  routes: [
    {
      path: "/",
      redirect: "/home",
    },
    {
      path: "/home",
      name: "Home",
      component: Home,
    },
    {
      path: "/categories",
      name: "Categories",
      component: Categories,
    },
    {
      path: "/shop",
      name: "Shop",
      component: Shop,
    },
    {
      path: "/profile",
      name: "Profile",
      component: Profile,
    },
    {
      path: "/detail/:iid",
      name: "Detail",
      component: Detail,
    },
  ],
  mode: "history", //修改模式为history
});
